package com.djy.shxt.nemt.api;

import com.djy.shxt.nemt.domain.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;


/**
 * @author daijiyong
 */
@RestController
@RequestMapping(value = "/api/analysis")
@Api(tags = "测试接口1")
public class AnalysisApi {

    private static final Logger log = LoggerFactory.getLogger(AnalysisApi.class);

    /**
     * 测试内容
     *
     * @param university 测试内容
     * @param speciality 测试内容
     * @return ApiResult
     */
    @GetMapping(value = "/occupationPortrait/{university}/{speciality}")
    @ApiOperation(value = "测试内容", response = ApiResult.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "university", value = "测试内容", dataType = "String", required = true),
            @ApiImplicitParam(name = "speciality", value = "测试内容", dataType = "String", required = true)
    })
    public ApiResult occupationPortrait(@PathVariable("university") String university, @PathVariable("speciality") String speciality) {
        ApiResult apiResult = ApiResult.success("测试内容");
        List<OccupationPortrait> list = new ArrayList<>();
        OccupationPortrait occupationPortrait1 = new OccupationPortrait("测试内容", "测试内容", 10000, 8000, 6000);
        occupationPortrait1.getTop3().add(new OccupationPortrait("测试内容", "测试内容", 10000, 10000, 10000));
        occupationPortrait1.getTop3().add(new OccupationPortrait("测试内容", "测试内容", 10000, 10000, 10000));
        occupationPortrait1.getTop3().add(new OccupationPortrait("测试内容", "测试内容", 10000, 10000, 10000));
        OccupationPortrait occupationPortrait2 = new OccupationPortrait("测试内容", "测试内容", 10000, 8000, 6000);
        occupationPortrait2.getTop3().add(new OccupationPortrait("测试内容", "测试内容", 10000, 10000, 10000));
        occupationPortrait2.getTop3().add(new OccupationPortrait("测试内容", "测试内容", 10000, 10000, 10000));
        occupationPortrait2.getTop3().add(new OccupationPortrait("测试内容", "测试内容", 10000, 10000, 10000));
        OccupationPortrait occupationPortrait3 = new OccupationPortrait("测试内容", "测试内容", 10000, 8000, 6000);
        occupationPortrait3.getTop3().add(new OccupationPortrait("测试内容", "测试内容", 10000, 10000, 10000));
        occupationPortrait3.getTop3().add(new OccupationPortrait("测试内容", "测试内容", 10000, 10000, 10000));
        occupationPortrait3.getTop3().add(new OccupationPortrait("测试内容", "测试内容", 10000, 10000, 10000));


        list.add(occupationPortrait1);
        list.add(occupationPortrait2);
        list.add(occupationPortrait3);

        apiResult.put("occupationPortrait", list);
        apiResult.put("summary", "测试内容，测试内容");
        return apiResult;
    }


    /**
     * 测试内容
     *
     * @param university 测试内容
     * @param speciality 测试内容
     * @return ApiResult
     */
    @GetMapping(value = "/path2higher/{university}/{speciality}")
    @ApiOperation(value = "测试内容", response = ApiResult.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "university", value = "测试内容", dataType = "String", required = true),
            @ApiImplicitParam(name = "speciality", value = "测试内容", dataType = "String", required = true)
    })
    public ApiResult path2higher(@PathVariable("university") String university, @PathVariable("speciality") String speciality) {
        ApiResult apiResult = ApiResult.success("测试内容");

        Path2Higher undergraduate = new Path2Higher("测试内容", 10000, 1000, 10.0);
        Path2Higher master = new Path2Higher("测试内容", 10000, 1000, 10.0);
        Path2Higher doctor = new Path2Higher("测试内容", 10000, 1000, 10.0);
        Path2Higher abroad = new Path2Higher("测试内容", 10000, 1000, 10.0);

        List<Path2Higher> list = new ArrayList<>();
        list.add(undergraduate);
        list.add(master);
        list.add(doctor);
        list.add(abroad);

        apiResult.put("path2higher", list);
        apiResult.put("summary", "测试内容，测试内容");
        return apiResult;
    }

    /**
     * 测试内容
     *
     * @param university 测试内容
     * @param speciality 测试内容
     * @return ApiResult
     */
    @GetMapping(value = "/publicPraise/{university}/{speciality}")
    @ApiOperation(value = "测试内容", response = ApiResult.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "university", value = "测试内容", dataType = "String", required = true),
            @ApiImplicitParam(name = "speciality", value = "测试内容", dataType = "String", required = true)
    })
    public ApiResult publicPraise(@PathVariable("university") String university, @PathVariable("speciality") String speciality) {
        ApiResult apiResult = ApiResult.success("测试内容");

        PublicPraise overallRating = new PublicPraise("测试内容", 10000, 9000, 1000);
        PublicPraise environment = new PublicPraise("测试内容", 10000, 9000, 1000);
        PublicPraise teachingLevel = new PublicPraise("测试内容", 10000, 9000, 1000);
        PublicPraise traffic = new PublicPraise("测试内容", 10000, 9000, 1000);

        List<PublicPraise> list = new ArrayList<>();
        list.add(overallRating);
        list.add(environment);
        list.add(teachingLevel);
        list.add(traffic);

        apiResult.put("publicPraise", list);
        apiResult.put("summary", "测试内容，测试内容");
        return apiResult;
    }

}
